package com.disease.api.service.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.disease.api.service.entity.eumns.RoleEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("base_user")
public class BaseUser {

    private String id;

    @TableField("org_code")
    private String orgCode;

    @TableField("dept_code")
    private String deptCode;

    @TableField("user_name")
    private String username;

    @TableField("password")
    private String password;

    @TableField("doctor_id")
    private String doctorId;

    @TableField("id_card_type_code")
    private String idCardTypeCode;

    @TableField("id_card")
    private String idCard;


    @TableField("tel")
    private String tel;

    @TableField("physician_no")
    private String physicianNo;

    @TableField("login_name")
    private String loginName;

    @TableField("user_type_code")
    private String userTypeCode;

    //医院:1,公卫科:2,管理员:9
    @TableField("role")
    private Integer role;

    @TableField("create_time")
    private String createTime;

    private List<String> deptNames;

    public BaseUser(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public BaseUser(String idCard) {
        this.idCard = idCard;
    }

    public static BaseUser PHUser() {
        BaseUser baseUser = new BaseUser();
        baseUser.setRole(RoleEnum.PH.getRoleId());
        return baseUser;
    }


    @Override
    public String toString() {
        return "BaseUser{" +
                "id='" + id + '\'' +
                ", orgCode='" + orgCode + '\'' +
                ", deptCode='" + deptCode + '\'' +
                ", userName='" + username + '\'' +
                ", idCardTypeCode='" + idCardTypeCode + '\'' +
                ", tel='" + tel + '\'' +
                ", physicianNo='" + physicianNo + '\'' +
                ", loginName='" + loginName + '\'' +
                ", userTypeCode='" + userTypeCode + '\'' +
                ", createTime='" + createTime + '\'' +
                '}';
    }
}
